package com.momo.elasticsearch;

import com.alibaba.fastjson.JSONObject;
import com.momo.elasticsearch.entity.EcDataLogDO;
import com.momo.elasticsearch.entity.EcMapper;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

/**
 * Created by MOMO on 2019/3/12.
 */
@RunWith(SpringRunner.class)
@SpringBootTest
@Slf4j
public class DocumentRequest {
    @Autowired
    private ElasticsearchUtil elasticsearchUtil;
    SnowFlake snowFlake = new SnowFlake(1, 1);
    @Autowired
    private EcMapper ecMapper;
    @Autowired
    private AsyncService asyncService;
    @Autowired
    private AsyncService asyncServiceTwo;

    //添加电梯数据
    @Test
    public void ecIndex() {
        //1744618
        EcDataLogDO ecDataLogDO = new EcDataLogDO();
        for (int i = 1; i <= 174462; i++) {
            log.info("================= " + i);
            asyncService.test(i);
            asyncServiceTwo.test(i);
        }

    }

    @Test
    public void getecDataLogDOOne() {
        elasticsearchUtil.getOneDocument("sys_core_alias","d_ec_data_log",302882625314492417L);
    }

}
